package com.liuhuan.controller;

import com.liuhuan.api.CommonResult;
import com.liuhuan.service.SendMailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.mail.MessagingException;

/**
 * @version 1.0
 * @Author liuhuan
 * @Date 2024/7/6 15:55
 * @注释
 */

@RestController
@Slf4j
@Api(tags = "邮箱模块")
public class SendMailController {
    @Autowired
    private SendMailService sendMailService;
    @PostMapping("/send-mail")
    @ApiOperation(value="发送邮件")
    public CommonResult send(@RequestParam ("email") String email) throws MessagingException {
        String code = sendMailService.sendMail(email);
        System.out.println(code);

        return CommonResult.success("发送成功",code);
    }
}

